package com.loeng.module.system.dal.mysql.tenant;

import com.loeng.framework.mybatis.core.mapper.BaseMapperX;
import com.loeng.module.system.dal.dataobject.tenant.TenantDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 租户 Mapper
 * @author loeng zhuo
 */
@Mapper
public interface TenantMapper extends BaseMapperX<TenantDO> {

    /**
     * 根据租户名查询租户
     *
     * @param name 租户名
     * @return 租户
     */
    default TenantDO selectByName(String name) {
        return selectOne(TenantDO::getName, name);
    }

    /**
     * 根据域名，获得租户信息
     *
     * @param website 域名
     * @return 租户信息
     */
    default TenantDO selectByWebsite(String website) {
        return selectOne(TenantDO::getWebsite, website);
    }
}
